Skip to main content

Update User Data

To update an existing user's profile, use the updateUser method. You must provide the updated User object and the original userID.

Usage Example:

import 'package:altibbi/service/api_service.dart';

ApiService apiService = ApiService();

void handleUpdate(User existingUser) async {
try {
existingUser.name = \"New Name\";
// Note: The SDK uses positional arguments (User userData, int userID)
User updatedUser = await apiService.updateUser(
existingUser,
existingUser.id!
);
print(\"User updated successfully: ${updatedUser.name}\");
} catch (e) {
print(\"Update Error: $e\");
}
}

Responses

Status 200 (OK)

Returns the updated User object.

Status 401 (Unauthorized)

Returned if the session token is missing or invalid.

Status 404 (Not Found)

Returned if the provided User ID does not exist.

Status 422 (Unprocessable Entity)

Returned if the updated fields fail validation.